package com.ruoyi.business.controller;

import com.ruoyi.business.BO.*;
import com.ruoyi.business.VO.*;
import com.ruoyi.business.service.HSPatientInfoService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;


@RestController
//@Api("慢性病管理医院端-患者信息")
@RequestMapping("/business/hspatientInfo")
public class HSPatientInfoController extends BaseController {
    @Autowired
    private HSPatientInfoService hsPatientInfoService;

    @GetMapping("/list")
    @ApiOperation("患者列表")
    public TableDataInfo list(PatientInfo patientInfo) {
        startPage();
        PatientInfoListVO resultList = hsPatientInfoService.selectPatientInfoList(patientInfo);
        if(null == resultList) {
            return getDataTable(new ArrayList<>());
        }
        return getDataTable(resultList.getResult());
    }

    @GetMapping("/selectPatientInfoById/{idcard}")
    @ApiOperation("获取患者详情")
    public AjaxResult selectPatientInfoById(@PathVariable("idcard") String idcard) {
        PatientInfoVO result = hsPatientInfoService.selectPatientInfoById(idcard);
        if(null == result) {
            return AjaxResult.error("接口超时!");
        }
        return success(result.getResult());
    }

    @GetMapping("/selectDetailedAssessment")
    @ApiOperation("分项估计")
    public AjaxResult selectDetailedAssessment(DetailedAssessmentBO detailedAssessmentBO) {
        DetailedAssessmentVO result = hsPatientInfoService.selectDetailedAssessment(detailedAssessmentBO);
        if(null == result) {
            return AjaxResult.error("接口超时");
        }
        return success(result.getResult());
    }

    @GetMapping("/selectHealthServicesChinapar")
    @ApiOperation("健康服务-心血管")
    public AjaxResult selectHealthServicesChinapar(HealthServicesChinaparBO healthServicesChinaparBO) {
        HealthServicesChinaparVO resutl = hsPatientInfoService.selectHealthServicesChinapar(healthServicesChinaparBO);
        if(null == resutl) {
            return AjaxResult.error("接口超时！");
        }
        return success(resutl.getResult());
    }

    @GetMapping("/selectHealthServicesDiabetes")
    @ApiOperation("健康服务-糖尿病")
    public AjaxResult selectHealthServicesDiabetes(HealthServicesDiabetesBO healthServicesChinaparBO) {
        HealthServicesDiabetesVO resutl = hsPatientInfoService.selectHealthServicesDiabetes(healthServicesChinaparBO);
        if(null == resutl) {
            return AjaxResult.error("接口超时！");
        }
        return success(resutl.getResult());
    }

    @GetMapping("/selectHealthServicesFattyliver")
    @ApiOperation("健康服务-脂肪肝")
    public AjaxResult selectHealthServicesFattyliver(HealthServicesFattyliverBO healthServicesFattyliverBO) {
        HealthServicesFattyliverVO resutl = hsPatientInfoService.selectHealthServicesFattyliver(healthServicesFattyliverBO);
        if(null == resutl) {
            return AjaxResult.error("接口超时！");
        }
        return success(resutl.getResult());
    }

    @GetMapping("/selectHealthServicesFib")
    @ApiOperation("健康服务-肝纤维化")
    public AjaxResult selectHealthServicesFib(HealthServicesFibBO healthServicesFibBO) {
        HealthServicesFibVO resutl = hsPatientInfoService.selectHealthServicesFib(healthServicesFibBO);
        if(null == resutl) {
            return AjaxResult.error("接口超时！");

        }
        return success(resutl.getResult());
    }

}
